<?php
/**
 * Created by gjk7788@163.com.
 * User: Carl
 * Date: 2018/6/22
 * Time: 10:56
 */

namespace App\Inspections;



use Mockery\Exception;

class InvalidKeywords
{
    protected $keywords = [
        'something forbidden'
    ];

    public function detect($body)
    {
        foreach ($this->keywords as $invalidKeyword) {
            if (stripos($body, $invalidKeyword) !== false) {
                throw new Exception('Your reply contains spam.');
            }
        }
    }
}